import fetch from './fetch'


//获取好友详情
export const getFriendDetail = (id) => fetch({
  url: `/friend/info/${id}`
})


// 获取群的详情
export const getGroupDetail = (groupId) => fetch({
  url: `/group/getInfo/${groupId}`
})

//退出群聊
export const logoutGroup = (id) => fetch({
  url: `/group/logoutGroup/${id}`
})


//解散群聊
export const dismissGroup = (groupId) => fetch({
  url: `/group/removeGroup/${groupId}`
})


export const applyList = () => fetch({
  url: "/apply/list"
})

//同意申请
export const applyAgreeFriend = (applyId) => fetch({
  url: `/apply/agree/${applyId}`
})


//发送消息 单聊
export const sendMessage = (data) => fetch({
  url: "/chat/sendMsg",
  data,
  method: "post"
})
//发群聊消息
export const sendGroupMessage = (data) => fetch({
  url: "/group/sendMsg",
  data,
  method: "post"
})

export const updateFile = (data) => fetch({
  url: "/file/upload",
  headers: {
    "Content-Type": "multipart/form-data",
  },
  method: "post",
  data
})

//批量发消息
export const sendForward = (data) => fetch({
  url: "/chat/batchForward",
  method: "POST",
  data,
})


//修改好友配置
export const editFriendRemark = (data) => fetch({
  url: "/friend/remark",
  method: "post",
  data
})

// 拒绝加入
export const refuseApply = (applyId) => fetch({
  url: `/apply/refused/${applyId}`
})

//申请添加好友
export const addFriendAction = (data) => fetch({
  url: "/apply/addFriend",
  data,
  method: "post"
})


//设置好友置顶状态
export const setFriendTopState = (data) => fetch({
  url: "/friend/top",
  data,
  method: "POST"
})

// 好友消息免打扰
export const setFriendDisturb = (data) => fetch({
  url: "/friend/disturb",
  data,
  method: "post"
})